﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MultiViewer.Master
{
    /// <summary>
    /// Interaction logic for DisplayStatusControl.xaml
    /// </summary>
    public partial class DisplayStatusControl : UserControl
    {
        private ClientNodeState nodeState = ClientNodeState.Disconnected;

        public DisplayStatusControl()
        {
            InitializeComponent();
        }

        public ClientNodeState NodeState
        {
            get
            {
                return nodeState;
            }
            set
            {
                nodeState = value;
                switch (nodeState)
                {
                    case ClientNodeState.Connected:
                        statusLed.Fill = Brushes.LightGreen;
                        statusText.Text = "Connected";
                        break;
                    case ClientNodeState.Disconnected:
                        statusLed.Fill = Brushes.Red;
                        statusText.Text = "Disconnected";
                        break;
                    case ClientNodeState.Initializing:
                        statusLed.Fill = Brushes.Yellow;
                        statusText.Text = "Querying...";
                        break;
                }
            }
        }
    }

    public enum ClientNodeState
    {
        Connected,
        Disconnected,
        Initializing
    }
}
